﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;


namespace Kaiser.Models.InputModels
{
    /// <summary>
    /// 编辑用户密码要么都为空，要么必须输入合法的密码
    /// </summary>
    public class UserInputEdit : UserInput
    {
        public UserInputEdit() { }
        public UserInputEdit(int? userID
            , Guid userGroupID
            , UserStatus status
            , string username, string displayName
            , string email, string password
            , string passwordConfirm
            , IEnumerable<Guid> roles
            , IEnumerable<Guid> permissions
            )
            : base(userID, userGroupID, status, username, displayName, email, roles, permissions)
        {
            Password = password;
            PasswordConfirm = passwordConfirm;
        }

        [StringLength(20, MinimumLength = 6, ErrorMessage = "登录密码请保持在6-20个字符之间")]
        [DataType(DataType.Password)]
        [DisplayName("登录密码")]
        public string Password { get; set; }

        [StringLength(20, MinimumLength = 6, ErrorMessage = "确认密码请保持在6-20个字符之间")]
       // [Compare("Password", ValidationCompareOperator.Equal, ValidationDataType.String, ErrorMessage = "请确认两次输入的密码一致")]
        [DataType(DataType.Password)]
        [DisplayName("确认密码")]
        public string PasswordConfirm { get; set; }
    }
}
